package com.ranjiaqi.map;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName Test01
 * @Description TODO
 * @Author hp
 * @Date 2021/6/25 15:39
 * @Version 1.0
 **/
public class Test01 {
    public static void main(String[] args) {
        countString();
    }
    public static void countString(){
        String str ="qwesfaAEQWDZXCE1324563!@#%!#$";
        Map<Character,Integer> map = new HashMap<>();
        char[] strchar = str.toCharArray();
        for (char c : strchar) {
            Integer value = map.get(c);
            if (value == null){
                map.put(c,1);
            }else {
                value++;
                map.put(c,value);
            }
        }
        System.out.println(map);
    }
}
